package com.xhwl.data.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xhwl.common.dto.cent.sdata.BuildingDTO;
import com.xhwl.common.pojo.ResultJson;
import com.xhwl.common.pojo.cent.sdata.Account;
import com.xhwl.common.pojo.cent.sdata.Building;
import com.xhwl.common.query.cent.sdata.BuildingQuery;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: luyi
 * @Description:
 * @Date: Create in 9:39 2021/4/14
 */
@RestController
public interface IBuildingService extends IService<Building> {

    /**
     * 创建
     *
     * @param building
     * @return
     */
    @RequestMapping(value = "/building-service/create", method = RequestMethod.POST)
    ResultJson create(@RequestPart BuildingDTO building);

    /**
     * 更新
     *
     * @param building
     * @return
     */
    @RequestMapping(value = "/building-service/update", method = RequestMethod.POST)
    ResultJson update(@RequestPart BuildingDTO building);

    /**
     * 分页
     *
     * @param buildingQuery
     * @param page
     * @return
     */
    @RequestMapping(value = "/building-service/page", method = RequestMethod.POST)
    Page<Building> page(@RequestPart BuildingQuery buildingQuery, @RequestPart Page page);

    /**
     * 查询楼栋列表
     *
     * @param buildingQuery projectId 项目ID
     * @return Building
     */
    @RequestMapping(value = "/building-service/list", method = RequestMethod.POST)
    List<Building> list(@RequestPart("buildingQuery") BuildingQuery buildingQuery);

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/building-service/delete", method = RequestMethod.POST)
    ResultJson delete(Integer id);

    /**
     * 详情
     *
     * @param id
     * @return
     */
    @RequestMapping(value = "/building-service/detail", method = RequestMethod.POST)
    Building detail(Integer id);

    @RequestMapping(value = "/building-service/detail-by-code", method = RequestMethod.POST)
    Building detailByCode(String code);

    /**
     * 批量创建
     *
     * @param buildingDTOs
     * @return
     */
    @RequestMapping(value = "/building-service/batch-create", method = RequestMethod.POST)
    ResultJson batchCreate(@RequestPart("buildingDTOs") List<BuildingDTO> buildingDTOs);


    ResultJson batchCreateFaster(List<BuildingDTO> buildingDTOs);

    /**
     * 获取当前编码
     *
     * @return
     */
    String getCurrentCode();


    /**
     * 通过模糊查询楼栋编码的方式来获取南飞鸿酆泽项目中的楼栋信息，南飞鸿酆泽主数据同步项目专属
     */
    @RequestMapping(value = "/building-service/get-nfh-building", method = RequestMethod.GET)
    List<Building> getNFHBuilding();

    /**
     * 查询对应 accountId 相关的空间路址
     *
     * @param account  账户 accountId
     * @param typeCode 空间路址类型编码,例如：floor、room等
     * @return
     */
    @RequestMapping(value = "/building-service/find-byAccount", method = RequestMethod.GET)
    List findSpace(@RequestPart("account") Account account, String typeCode);

    ResultJson refreshSort(BuildingQuery buildingQuery);
}
